<template>
  <div>
    <div class="title">神领快递</div>

    <div class="loginWay">
          <h1>账号登陆</h1>
          <div class="byPhone">手机号登录</div>
    </div>
    <form>
      <div>
        <input type="text" v-model="account" placeholder="请输入账号">
      </div>
      <div>
        <input type="password" v-model="password" placeholder="请输入密码">
      </div>
      <button type="button" @click="login">登录</button>
    </form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      account: '',
      password: ''
    }
  },
  methods:{
   async login(){
      let res = await uni.$http.post('/login/account',{
        account:this.account,
        password:this.password
      })
      uni.setStorageSync('token',res.data.data)
     
     if(res.data.data){
       uni.switchTab({
         url:'/pages/index/index'
       })
       }
    }
  }
}
</script>
<style lang="scss">
  page{
    padding: 0 33px;
  }
  button{
    width: 309px;
    height: 50px;
    background: #EF4F3F;
    border-radius: 24.77px;
    color: #fff;
    margin-top: 50px;
  }
  input{
    border: none; 
    border-bottom: 1px solid #ccc;
    height: 60px;
    font-size: 16px;
    
  }
  .title{
    width: 72px;
    height: 25px;
    font-family: PingFangSC-SNaNpxibold;
    font-weight: 600;
    font-size: 18px;
    color: #2A2929;
    letter-spacing: 0;
    margin: 0 auto 50px;
  }
  .loginWay{
    display: flex;
    justify-content: space-between;
    h1{
      width: 96px;
      height: 33px;
      font-family: PingFangSC-SNaNpxibold;
      font-weight: 600;
      font-size: 24px;
      color: #2A2929;
      letter-spacing: 0;
    }
    .byPhone{
      width: 80px;
      height: 22px;
      font-family: PingFangSC-Medium;
      font-weight: 600;
      font-size: 16px;
      color: #EF4F3F;
      letter-spacing: 0;
      text-align: right;
    }
  }
</style>